package com.qiyun.framework.helper;
import org.xutils.HttpManager;
import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;

/**
 * http请求类
 * Created by Tiger on 16/2/29.
 */
public class HttpHelper {
    private static HttpManager httpUtils;

    /**
     * 单例http
     * @return
     */
    public static HttpManager getHttpUtils() {
        if(httpUtils==null){
            httpUtils= x.http();
        }
        return httpUtils;
    }

    /**
     * post请求
     * @param param
     * @param callBack
     */
    public static void sendPostRequest(RequestParams param, Callback.CommonCallback callBack) {
        getHttpUtils().post(param, callBack);
    }

    /**
     * get请求
     * @param param
     * @param callBack
     */
    public static void sendGetRequest(RequestParams param, Callback.CommonCallback callBack) {
        getHttpUtils().post(param, callBack);
    }

}
